<template>
	<view class="content">
		<custom-header title='来宾住宿'></custom-header>
		<view class="jdms_box">
			<view class="name">{{zsList.title}}</view>
			<view class="address flex">
				<view class="img_sty">
					<image src="../../static/list/add.png"></image>
				</view>
				<view class="text">酒店地址：{{zsList.address}}</view>
			</view>
			<view class="address flex">
				<view class="img_sty">
					<image src="../../static/list/ph.png"></image>
				</view>
				<view class="text">联系电话：{{zsList.phone}}</view>
			</view>
			<view class="jd_img">
				<image :src="zsList.cover" mode="aspectFill"></image>
			</view>
			<uni-search-bar v-model="keyword" @cancel="search" cancelText="搜索" cancelButton="always"
				placeholder="请输入搜索内容">
			</uni-search-bar>
			<view class="table_wrap">
				<view class="name_box">
					<view class="name_tt">姓名</view>
					<view class="name_tt">房间号</view>
					<view class="name_tt">餐桌号</view>
					<view class="name_tt">签到情况</view>
				</view>
				<view class="mm_text" v-for="(item,index) in dotList">
					<view class="ll_yy">{{item.name}}</view>
					<view class="ll_yy">{{item.room_no}}</view>
					<view class="ll_yy">{{item.table_number}}</view>
					<view class="ll_yy3" v-if="item.is_sign==0" @click="qiandao(item.id,1,index)">未签到</view>
					<view class="ll_yy2" v-if="item.is_sign==1" @click="qiandao(item.id,2,index)">已签到</view>
				</view>
			</view>
		</view>
		<view class="bottom"></view>
		<custom-tabbar></custom-tabbar>
	</view>
</template>

<script>
	import {
		stayList,
		qdList
	} from '../../api/fan';
	export default {
		data() {
			return {
				searchValue: '',
				dotList: [],
				zsList: [],
				id: '',
				keyword: ''
			}
		},
		onLoad() {
			this.id = uni.getStorageSync("id")
			this.stayLists()
		},
		methods: {
			search() {
				this.keyword = this.keyword
				this.stayLists()
			},
			stayLists() {
				stayList(this.id, this.keyword).then(res => {
					this.dotList = res.data.data.stay_list
					this.zsList = res.data.data.hotel_content
				})
			},
			qiandao(ids, type, index) {
				qdList(this.id, ids, type).then(res => {

					if (res.data.code == 200) {
						this.dotList[index].is_sign = type == 2 ? 0 : 1
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background-color: #f5fffe;
		padding-bottom: 50upx;
		background: url(../../static/index/Group.png);
		background-attachment: fixed;
		background-position: -180upx 450upx;
	}

	uni-table,
	view,
	text,
	image {
		background-color: rgba(255, 255, 255, 0) ;
	}

	.bottom {
		width: 100%;
		height: 200rpx;
	}
	
	.jdms_box {
		width: 96%;
		margin-top: 120rpx !important;
		margin: 0 auto;
		background-color: #fff !important;
		border-radius: 30rpx;
		padding: 40upx 30rpx 0 30upx;
		.jd_img {
			width: 100%;
			margin: 0 auto;
			height: 300rpx;
			border-radius: 20rpx;
			image {
				width: 100%;
				height: 100%;
			}
		}

		.name {
			font-family: 'alimother';
			font-size: 46rpx;
			font-weight: 700;
			// padding-left: 30rpx;
			color: #394f49;
			margin-bottom: 40rpx;
		}

		.address {
			justify-content: flex-start;
			align-items: center;
			margin-bottom: 16rpx;

			.img_sty {
				width: 30rpx;
				height: 30rpx;
				margin-left: 30rpx;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.text {
				margin-left: 10rpx;
				font-size: 38rpx;
				font-weight: 700;
				color: #394f49;
			}
		}

		.table_wrap {
			width: 96%;
			margin: 0 auto;
			margin-top: 30rpx;

			.name_box {
				width: 100%;
				display: flex;
				justify-content: space-between;
				align-items: center;
				font-size: 34rpx;
				font-weight: 700;
				color: #394f49;
				padding-bottom: 20rpx;

				.name_tt {
					width: 25%;
					text-align: left;
				}
			}

			.mm_text {
				width: 100%;
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding-bottom: 20rpx;

				.ll_yy {
					width: 25%;
					text-align: left;
					font-size: 30rpx;
					color: #394f49;
				}

				.ll_yy3 {
					margin: 0 auto;
					height: 50rpx;
					color: #fff;
					background-color: #59b6b9 !important;
					font-size: 30rpx;
					padding: 4rpx 20rpx;
					border-radius: 20rpx;

				}

				.ll_yy2 {
					margin: 0 auto;
					height: 50rpx;
					color: #969898;
					font-size: 30rpx;
				}
			}
		}
	}


	.dyb {
		border-bottom: 2rpx solid #4bcc99;
		color: #394f49;
	}
</style>